package com.esri.core.portal;

import com.esri.core.internal.tasks.ags.PortalFetchThumbnail;
import com.esri.core.internal.tasks.ags.ak;
import com.esri.core.internal.tasks.ags.al;
import com.esri.core.internal.tasks.ags.z;
import com.esri.core.internal.util.d;
import java.util.ArrayList;
import java.util.List;
import org.achartengine.internal.a;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class PortalGroup {
    final Portal a;
    String b;
    String c;
    String d;
    String e;
    String f;
    List<String> g;
    String h;
    long i;
    long j;
    boolean k;
    PortalAccess l;
    List<String> m;
    List<String> n;
    String o;
    String p;
    private boolean q;

    public boolean isViewOnly() {
        return this.q;
    }

    PortalGroup(Portal portal) {
        this.a = portal;
    }

    public boolean fetchAndUpdateMembership() throws Exception {
        String str = this.b;
        if (str == null || "".equals(str)) {
            return false;
        }
        ak execute = new z(new al(this.a), this.a.findSharingUrl(), this.b, this.a.b).execute();
        if (execute != null) {
            this.n = execute.a();
            this.m = execute.b();
            return true;
        }
        return true;
    }

    public byte[] fetchThumbnail() throws Exception {
        String str = this.h;
        if (str == null || str.trim().length() == 0 || "null".equalsIgnoreCase(this.h)) {
            return null;
        }
        return new PortalFetchThumbnail(a(), this.a.b).execute();
    }

    private final String a() {
        try {
            return this.a.findSharingUrl() + "/community/groups/" + this.b + "/info/" + this.h;
        } catch (Exception unused) {
            return null;
        }
    }

    public static PortalGroup fromJson(JsonParser jsonParser, Portal portal) throws Exception {
        if (d.c(jsonParser)) {
            PortalGroup portalGroup = new PortalGroup(portal);
            jsonParser.enable(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS);
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                String currentName = jsonParser.getCurrentName();
                jsonParser.nextToken();
                if (currentName.equals("id")) {
                    portalGroup.b = jsonParser.getText();
                } else if (currentName.equals(a.b)) {
                    portalGroup.c = jsonParser.getText();
                } else if (currentName.equals("owner")) {
                    portalGroup.d = jsonParser.getText();
                } else if (currentName.equals("description")) {
                    portalGroup.e = jsonParser.getText();
                } else if (currentName.equals("snippet")) {
                    portalGroup.f = jsonParser.getText();
                } else if (currentName.equals("tags")) {
                    portalGroup.g = new ArrayList();
                    while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                        portalGroup.g.add(jsonParser.getText());
                    }
                } else if (currentName.equals("thumbnail")) {
                    portalGroup.h = jsonParser.getText();
                } else if (currentName.equals("created")) {
                    portalGroup.i = jsonParser.getLongValue();
                } else if (currentName.equals("modified")) {
                    portalGroup.j = jsonParser.getLongValue();
                } else if (currentName.equals("access")) {
                    portalGroup.l = PortalAccess.a(jsonParser.getText(), portal.isPreVersion162());
                } else if (currentName.equals("isInvitationOnly")) {
                    portalGroup.k = jsonParser.getBooleanValue();
                } else if (currentName.equals("sortField")) {
                    portalGroup.o = jsonParser.getText();
                } else if (currentName.equals("sortOrder")) {
                    portalGroup.p = jsonParser.getText();
                } else if (currentName.equals("isViewOnly")) {
                    portalGroup.q = jsonParser.getBooleanValue();
                } else {
                    jsonParser.skipChildren();
                }
            }
            return portalGroup;
        }
        return null;
    }

    public Portal getPortal() {
        return this.a;
    }

    public String getGroupId() {
        return this.b;
    }

    public String getTitle() {
        return this.c;
    }

    public String getOwner() {
        return this.d;
    }

    public String getDescription() {
        return this.e;
    }

    public String getSnippet() {
        return this.f;
    }

    public List<String> getTags() {
        return this.g;
    }

    public String getThumbnailFileName() {
        return this.h;
    }

    public long getCreated() {
        return this.i;
    }

    public long getModified() {
        return this.j;
    }

    public boolean isInvitationOnly() {
        return this.k;
    }

    public PortalAccess getAccess() {
        return this.l;
    }

    public List<String> getUsers() {
        return this.m;
    }

    public List<String> getAdmins() {
        return this.n;
    }

    public String getSortField() {
        return this.o;
    }

    public String getSortOrder() {
        return this.p;
    }

    public int hashCode() {
        PortalAccess portalAccess = this.l;
        int hashCode = ((portalAccess == null ? 0 : portalAccess.hashCode()) + 31) * 31;
        List<String> list = this.n;
        int hashCode2 = list == null ? 0 : list.hashCode();
        long j = this.i;
        int i = (((hashCode + hashCode2) * 31) + ((int) (j ^ (j >>> 32)))) * 31;
        String str = this.e;
        int hashCode3 = (i + (str == null ? 0 : str.hashCode())) * 31;
        String str2 = this.b;
        int hashCode4 = (hashCode3 + (str2 == null ? 0 : str2.hashCode())) * 31;
        int i2 = this.k ? 1231 : 1237;
        long j2 = this.j;
        int i3 = (((hashCode4 + i2) * 31) + ((int) (j2 ^ (j2 >>> 32)))) * 31;
        String str3 = this.d;
        int hashCode5 = (i3 + (str3 == null ? 0 : str3.hashCode())) * 31;
        Portal portal = this.a;
        int hashCode6 = (hashCode5 + (portal == null ? 0 : portal.hashCode())) * 31;
        String str4 = this.f;
        int hashCode7 = (hashCode6 + (str4 == null ? 0 : str4.hashCode())) * 31;
        List<String> list2 = this.g;
        int hashCode8 = (hashCode7 + (list2 == null ? 0 : list2.hashCode())) * 31;
        String str5 = this.h;
        int hashCode9 = (hashCode8 + (str5 == null ? 0 : str5.hashCode())) * 31;
        String str6 = this.c;
        int hashCode10 = (hashCode9 + (str6 == null ? 0 : str6.hashCode())) * 31;
        List<String> list3 = this.m;
        int hashCode11 = (hashCode10 + (list3 == null ? 0 : list3.hashCode())) * 31;
        String str7 = this.o;
        int hashCode12 = (hashCode11 + (str7 == null ? 0 : str7.hashCode())) * 31;
        String str8 = this.p;
        return hashCode12 + (str8 != null ? str8.hashCode() : 0);
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && (obj instanceof PortalGroup)) {
            PortalGroup portalGroup = (PortalGroup) obj;
            if (this.l != portalGroup.l) {
                return false;
            }
            List<String> list = this.n;
            if (list == null) {
                if (portalGroup.n != null) {
                    return false;
                }
            } else if (!list.equals(portalGroup.n)) {
                return false;
            }
            if (this.i != portalGroup.i) {
                return false;
            }
            String str = this.e;
            if (str == null) {
                if (portalGroup.e != null) {
                    return false;
                }
            } else if (!str.equals(portalGroup.e)) {
                return false;
            }
            String str2 = this.b;
            if (str2 == null) {
                if (portalGroup.b != null) {
                    return false;
                }
            } else if (!str2.equals(portalGroup.b)) {
                return false;
            }
            if (this.k == portalGroup.k && this.j == portalGroup.j) {
                String str3 = this.d;
                if (str3 == null) {
                    if (portalGroup.d != null) {
                        return false;
                    }
                } else if (!str3.equals(portalGroup.d)) {
                    return false;
                }
                Portal portal = this.a;
                if (portal == null) {
                    if (portalGroup.a != null) {
                        return false;
                    }
                } else if (!portal.equals(portalGroup.a)) {
                    return false;
                }
                String str4 = this.f;
                if (str4 == null) {
                    if (portalGroup.f != null) {
                        return false;
                    }
                } else if (!str4.equals(portalGroup.f)) {
                    return false;
                }
                List<String> list2 = this.g;
                if (list2 == null) {
                    if (portalGroup.g != null) {
                        return false;
                    }
                } else if (!list2.equals(portalGroup.g)) {
                    return false;
                }
                String str5 = this.h;
                if (str5 == null) {
                    if (portalGroup.h != null) {
                        return false;
                    }
                } else if (!str5.equals(portalGroup.h)) {
                    return false;
                }
                String str6 = this.c;
                if (str6 == null) {
                    if (portalGroup.c != null) {
                        return false;
                    }
                } else if (!str6.equals(portalGroup.c)) {
                    return false;
                }
                List<String> list3 = this.m;
                if (list3 == null) {
                    if (portalGroup.m != null) {
                        return false;
                    }
                } else if (!list3.equals(portalGroup.m)) {
                    return false;
                }
                String str7 = this.o;
                if (str7 == null) {
                    if (portalGroup.o != null) {
                        return false;
                    }
                } else if (!str7.equals(portalGroup.o)) {
                    return false;
                }
                String str8 = this.p;
                if (str8 == null) {
                    if (portalGroup.p != null) {
                        return false;
                    }
                } else if (!str8.equals(portalGroup.p)) {
                    return false;
                }
                return true;
            }
            return false;
        }
        return false;
    }

    public String toString() {
        return "PortalGroup [groupId=" + this.b + ", title=" + this.c + ", owner=" + this.d + ", description=" + this.e + ", snippet=" + this.f + ", tags=" + this.g + ", thumbnail=" + this.h + ", created=" + this.i + ", modified=" + this.j + ", access=" + this.l + ", isInvitationOnly=" + this.k + ", users=" + this.m + ", admins=" + this.n + ", sortField=" + this.o + ", sortOrder=" + this.p + "]";
    }
}
